package com.kaikeba.dao;

import com.kaikeba.bean.LinkData;
import com.kaikeba.bean.Type;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by HMF on 2021/06/16 14:15
 */
@Mapper
public interface LinkMapper {
    @Select("SELECT t.id tid, t.name, t.sort tsort, l.id lid, l.type_id, l.icon, l.title, l.description, l.count, l.sort lsort, l.content FROM kkb_type t, kkb_link l WHERE t.id=l.type_id ORDER BY t.sort, l.sort ASC\n")
    List<LinkData> findAll();

    @Select("select content from kkb_link where id = #{id}")
    String findById(@Param(value = "id") int id);

    @Select("select * from kkb_type")
    List<Type> findAllType();
}
